import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

const path = require('path');

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: [
      { find: '@', replacement: path.resolve(__dirname, 'src') },
      // 解决引入 @import '~antd/es/style/themes/default.less';报错的问题，需要配合(步骤二)实现
      {
        find: /^~/,
        replacement: '',
      },
    ],
  },
  // 步骤二
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
});
